<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:set var="current" value="${parent}" scope="page" /> 

<c:if  test="${!empty current.parent}"> 
	<c:set var="parent" value="${current.parent}" scope="request" /> 
	<jsp:include page="parent_recurse.jsp" />
</c:if>

<c:set var="hasDetail" value="false" />
<c:if  test="${(!empty current.workPhone) || (!empty current.cellPhone) || (!empty current.email) || (!empty current.altEmail) || (!empty current.url)}">
	<c:set var="hasDetail" value="true" />
</c:if>

<div class="cmd-partent-item" style="float:left;margin-right:10px;">
	<div class="cmd-tree-item-wrapper ui-corner-all">
		<c:if  test="${!empty current.tagId}">
			<c:choose>
				<c:when test="${current.tagId == 1}">
					<div class="cmd-tree-item-section cmd-tree-item-label-red">Agency</div>
				</c:when>
				<c:when test="${current.tagId == 2}">
					<div class="cmd-tree-item-section cmd-tree-item-label-blue">Rep</div>
				</c:when>
				<c:when test="${current.tagId == 3}">
					<div class="cmd-tree-item-section cmd-tree-item-label-orange">Job</div>
				</c:when>
				<c:when test="${current.tagId == 4}">
					<div class="cmd-tree-item-section cmd-tree-item-label-green">Contact</div>
				</c:when>
			</c:choose>
		</c:if>
		
		<div class="cmd-tree-item-section cmd-tree-item-content">
			${current.lastName}<c:if  test="${!empty current.firstName}">, ${current.firstName}</c:if>&nbsp;
		</div>
	</div>
	<c:if  test="${hasDetail}">
		<br/>
		<div id="detail-table-holder${contact.id}" class="detail-table-holder">
			
			<table id="detail-table${contact.id}" class="detail-table">
			<c:if  test="${!empty contact.workPhone}">
				<tr><td>Work Phone</td><td>${contact.workPhone}</td></tr>
			</c:if>
			<c:if  test="${!empty contact.cellPhone}">
				<tr><td>Cell Phone</td><td>${contact.cellPhone}</td></tr>
			</c:if>
			<c:if  test="${!empty contact.email}">
				<tr><td>Email</td><td>${contact.email}</td></tr>
			</c:if>
			<c:if  test="${!empty contact.altEmail}">
				<tr><td>Alt. Email</td><td>${contact.altEmail}</td></tr>
			</c:if>
			<c:if  test="${!empty contact.url}">
				<tr><td>URL</td><td>${contact.url}</td></tr>
			</c:if>
			</table>
			
		</div>
	</c:if>
</div>